home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / dev / lang / Python16_Src.lha / Python16_Source / Python / strdup.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-01-28  |  262 b   |  16 lines

  1. /* strdup() replacement (from stdwin, if you must know) */
  2.  
  3. #include "pgenheaders.h"
  4.  
  5. char *
  6. strdup(str)
  7.     const char *str;
  8. {
  9.     if (str != NULL) {
  10.         register char *copy = malloc(strlen(str) + 1);
  11.         if (copy != NULL)
  12.             return strcpy(copy, str);
  13.     }
  14.     return NULL;
  15. }
  16.